// app.js
App({
  onLaunch() {
    const token = wx.getStorageSync('token') || ''
    if(!token){
      wx.redirectTo({
        url: '/pages/index/index',
      })
    }
    wx.getSetting({
      success(res) {
        if (!res.authSetting['scope.userInfo']) {
          wx.authorize({
            scope: 'scope.userInfo',
            success () {
              // 用户已经同意小程序使用录音功能，后续调用 wx.startRecord 接口不会弹窗询问
              wx.startRecord()
            }
          })
        }
      }
    })
  },
})
